package algorithm;

public class leetcode_0045 {
    public int jump(int[] nums) {
        int len=nums.length;
        int position=0;
        int end=0;
        int step=0;
        for(int i=0;i<len-1;++i){
            position=(position>i+nums[i])?position:(nums[i]+i);
            if(i==end){
                end=position;
                step++;

            }
        }
        return step;
    }
}
